<?php
require_once('./FileCache.php');

/**
 * 首页业务逻辑
 */
class content{

	function __construct(){
		$this->db = 'obj';
	}
	//获取baner数据
	function getBnaer(){
		$f = new FileCache('.txt');
		$rs = $f->getFileCache('index_baner_data','index');
		if($rs){
			echo "我是文件缓存";
			return $rs;
		}else{
			echo "请求数据库";
		//如果$rs不为真，从数据库里拿，写入缓存
		//$data = $this->db->where()->select();
		//$f->setFileCache('index_baner_data','index');
		//return $data;
		
		}



	}
}

$c = new content();
$data = $c->getBnaer();
print_r($data);



//#### test
$data = array(
 array('id'=>1,'cid'=>'100','title'=>'大雪封山了，过年咋回去？','url'=>'123xdd.jpg'),
 array('id'=>2,'cid'=>'100','title'=>'过年不回去了，去哪浪','url'=>'2.jpg'),
 array('id'=>3,'cid'=>'100','title'=>'有没有租出拼车回去的','url'=>'11123xdd.jpg'),
 array('id'=>4,'cid'=>'100','title'=>'哎呀，不想了，去滑雪吧','url'=>'13323xdd.jpg'),
 array('id'=>5,'cid'=>'100','title'=>'去重庆玩玩吧？','url'=>'12333xdd.jpg'),
 array('id'=>6,'cid'=>'100','title'=>'重庆火锅我来了','url'=>'1233333xdd.jpg'),
);
//$f = new FileCache('.txt');
//$rs = $f->setFileCache('index_baner_data',$data,'index');
//$rs = $f->setFileCache('index_baner_data',$data,'link');

//$rs = $f->getFileCache('index_baner_data','index');
//$rs = $f->deleteFileCache('index_baner_data','index');
//var_dump($rs);